import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from "@angular/common/http";

import { Observable, of } from "rxjs";
import { tap } from 'rxjs/operators';
@Injectable({
  providedIn: 'root'
})
export class WaitTasksService {

  constructor(
    private http: HttpClient
  ) { }

  //获取可用分类列表
  GetDict(): Observable<any> {
    var baseUrl = "/api/toDoSummary/getDict"
    // let _dataJson = {
    //   params: {
    //     ...data
    //   }
    // }
    return this.http.get(baseUrl).pipe();
  }

  //新加
  private getDataUrl = '/api/toDoSummary/getTodos'
  GetTodos(data, typeId): Observable<any> {
    let _dataJson = {
      params: {
        ...data
      }
    }
    var basd = this.getDataUrl + '?categoryType=' + typeId + ''
    return this.http.post(basd, _dataJson).pipe();
  }


  //获取可用分类列表
  GetGroupTodos(): Observable<any> {
    var baseUrl = "/api/toDoSummary/getGroupTodos"
    return this.http.get(baseUrl).pipe();
  }

    //修改
    private updateUrl="/api/roles/todo";
    WaitTasksTodo(data): Observable<any> {
      let _dataJson = {
          ...data
      }
      return this.http.put(this.updateUrl, _dataJson, {})
  }    
}
